<?php
class accessController extends Controller{
    public function __construct(){
        parent::__construct();
        //检测session
        if(!isset($_SESSION['MY'])){
            exit('请走正门！');
        }
		$group_id=intval($_SESSION['MY']['GROUP_ID']);
		if($group_id>0 and $group_id!=1){
			$priv=$_SESSION['MY']['PRIV'];
			
			$file=CONTROLLER_DIR.'these.names.php';
			if(file_exists($file)){
				$file_data=include($file);
				$file_data['except_controllers']=(array) $file_data['except_controllers'];
			}else{
				$file_data=array();
				$file_data['except_controllers']=array();
			}
			
			if(!in_array($_GET['m'],$file_data['except_controllers'])){
			
				if(!array_key_exists($_GET['m'],$priv)){
					$msg=$_GET['m'].' 权限缺失，请联系管理员！';
					include($this->viewer_dir.'shell/deny.php');
					exit;
				}
				if(!in_array($_GET['a'],isset($priv[$_GET['m']])?$priv[$_GET['m']]:array())){
					$msg=$_GET['m'].'/'.$_GET['a'].' 权限缺失，请联系管理员！';
					include($this->viewer_dir.'shell/deny.php');
					exit;
				}
			
			}
			
		}
    }
}